<template>
  <div id="all">
    <div>
      <el-button type="primary" @click="getData()">请求数据</el-button>
      <el-table :data="tabData" style="width: 100%">
        <el-table-column prop="id" label="ID" width="40">
        </el-table-column>
        <el-table-column prop="industryName" label="行业类型" width="180">
        </el-table-column>

      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  name: "mockAxios",
  data() {
    return {
      tabData: [],
    };
  },
  mounted() {},
  methods: {
    getData() {
      //在axios 文件中已经配置了mock拦截请求
      this.$axios.get("http://localhost:8080/industry").then((res) => {
        console.log(res.data); // 直接打印res可以显示很多数据 如响应头信息等等
        this.tabData = res.data.data;
      });
    },
  },
};
</script>

<style scoped="scoped">
#all {
  width: 100%;
  height: 100%;
  background-color: #fff;
}
</style>
